<%@ page import="bog.Answer; bog.Thread" %>



<div class="fieldcontain ${hasErrors(bean: threadInstance, field: 'question', 'error')} required">
	<label for="question">
		<g:message code="thread.question.label" default="Question" />
		<span class="required-indicator">*</span>
	</label>
	<g:select id="question" name="question.id" from="${Answer.list()}" optionKey="id" required="" value="${threadInstance?.question?.id}" class="many-to-one"/>
</div>

<div class="fieldcontain ${hasErrors(bean: threadInstance, field: 'answers', 'error')} ">
	<label for="answers">
		<g:message code="thread.answers.label" default="Answers" />
		
	</label>
	
<ul class="one-to-many">
<g:each in="${threadInstance?.answers?}" var="a">
    <li><g:link controller="post" action="show" id="${a.id}">${a?.encodeAsHTML()}</g:link></li>
</g:each>
<li class="add">
<g:link controller="post" action="create" params="['thread.id': threadInstance?.id]">${message(code: 'default.add.label', args: [message(code: 'post.label', default: 'Answer')])}</g:link>
</li>
</ul>

</div>

<div class="fieldcontain ${hasErrors(bean: threadInstance, field: 'course', 'error')} required">
	<label for="course">
		<g:message code="thread.course.label" default="Course" />
		<span class="required-indicator">*</span>
	</label>
	<g:select id="course" name="course.id" from="${bog.Course.list()}" optionKey="id" required="" value="${threadInstance?.course?.id}" class="many-to-one"/>
</div>

<div class="fieldcontain ${hasErrors(bean: threadInstance, field: 'tags', 'error')} ">
	<label for="tags">
		<g:message code="thread.tags.label" default="Tags" />
		
	</label>
	<g:select name="tags" from="${bog.Tag.list()}" multiple="multiple" optionKey="id" size="5" value="${threadInstance?.tags*.id}" class="many-to-many"/>
</div>

